#pragma once

#include <string_view>
#include <string>

struct git_reference;
struct git_repository;

namespace git
{

class Ref
{
public:
    Ref() {}

    Ref(git_reference *ref);

    Ref(const Ref &) = delete;

    Ref(Ref &&ref);

    virtual ~Ref();

    Ref &operator=(const Ref &) = delete;

    Ref &operator=(Ref &&b);

    operator bool() const {
        return ref_;
    }

    std::string_view fullname() const;

    std::string oidHex() const;

    git_reference *provider() {
        return ref_;
    }

protected:
    git_repository *repo() const;

protected:
    git_reference *ref_ = nullptr;
};

} // namespace git
